import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
class SwitchAndCheckBoxPage extends  StatefulWidget{
  @override
  _SwitchAndCheckBoxPage createState() =>new _SwitchAndCheckBoxPage();

}
class _SwitchAndCheckBoxPage extends State<SwitchAndCheckBoxPage>{
  bool switchOpen=true;
  bool checkBoxCheck=false;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(title: Text("SwitchAndCheckBoxPage"),),
      body: Column(
        children: <Widget>[
          Switch(
            value:switchOpen,
            onChanged: (value){
              setState(() {
                switchOpen=value;
              });
                print('switch state is $switchOpen');
            },
          ),
          Checkbox(
            value: checkBoxCheck,
            onChanged: (value){
              setState(() {
                checkBoxCheck=value;
              });
              print('check box is $checkBoxCheck');
            },
          )
          ],
      ),
    );
  }

}
